package com.test.kupi.page.object;

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.PageFactory;
import org.openqa.selenium.support.FindBy;

public class PageLogin extends Page{
	
	@FindBy(linkText = "Вход")
	private WebElement signIn;
	
	@FindBy(name = "login")
	private WebElement login;
	
	@FindBy(name = "password")
	private WebElement password;
	
	@FindBy(css = "input.button")
	private WebElement inputButton;
	
	public PageLogin(WebDriver driver) {
        PageFactory.initElements(driver, this);
        this.driver = driver;
    }
    
	public PageLogin setLoginField(String text) {
		login.sendKeys(text);
		return this;
	}
	
	public PageLogin setPasswordField(String text) {
		password.sendKeys(text);
		return this;
	}
	
	public void clickSignButton() {
		signIn.click();
	}
	
	public void clickSubmitButton() {
		inputButton.click();
	}
}
